﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>系统正在启动中 ...</title>
    <script language="javascript" type="text/javascript">
        var t_id = setInterval(animate, 20);
        var pos = 0; var dir = 2; var len = 0;

        function animate() {
            var elem = document.getElementById('progress');
            if (elem != null) {
                if (pos == 0) len += dir;
                if (len > 32 || pos > 79) pos += dir;
                if (pos > 79) len -= dir;
                if (pos > 79 && len == 0) pos = 0;
                elem.style.left = pos;
                elem.style.width = len;
            }
        }
        function stopAnimate() {
            clearInterval(t_id);
            var elem = document.getElementById('loader_container');
            elem.style.display = 'none';
        }
    </script>
    <style>
        #loader_container
        {
            text-align: center;
            position: absolute;
            top: 40%;
            width: 100%;
            left: 0;
        }
        #loader
        {
            font-family: Tahoma, Helvetica, sans;
            font-size: 11.5px;
            color: #000000;
            background-color: #FFFFFF;
            padding: 10px 0 16px 0;
            margin: 0 auto;
            display: block;
            width: 130px;
            border: 1px solid #5a667b;
            text-align: left;
            z-index: 2;
        }
        #progress
        {
            height: 5px;
            font-size: 1px;
            width: 1px;
            position: relative;
            top: 1px;
            left: 0px;
            background-color: #8894a8;
        }
        #loader_bg
        {
            background-color: #e4e7eb;
            position: relative;
            top: 8px;
            left: 8px;
            height: 7px;
            width: 113px;
            font-size: 1px;
        }
    </style>
</head>
<body>
    <div id="loader_container">
        <div id="loader">
            <div align="center">
                系统正在启动中 ...</div>
            <div id="loader_bg">
                <div id="progress">
                </div>
            </div>
        </div>
    </div>
    <div style="position: absolute; left: 1em; top: 1em; width: 320px; padding: .3em;
        background: #900; color: #fff; display: none;">
        <strong>系统启动发生异常</strong>
        <div id="start_fail">
        </div>
    </div>
    <script type="text/javascript" language="javascript">
        (function (w) {
            var xhr;
            if (w.XMLHttpRequest && !w.ActiveXObject) {
                xhr = new w.XMLHttpRequest();
            } else {
                try {
                    xhr = new w.ActiveXObject('Microsoft.XMLHTTP');
                } catch (e) { }
            }

            if (xhr) {
                xhr.open('GET', '?ajax=1');
                xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        //只有返回http 200时才表示正常
                        if (xhr.status === 200) {
                            xhr = null;
                            location.reload();
                        } else {
                            //否则输出http状态码和状态说明,以及返回的html
                            stopAnimate();
                            var ele = document.getElementById('start_fail');
                            ele.innerHTML = 'HTTP ' + xhr.status + ' ' + xhr.statusText + '<br/>' + xhr.responseText;
                            var par = ele.parentNode;
                            if (par) {
                                par.style.display = 'block';
                            }
                        }
                        xhr = null;
                    }
                };
                xhr.send();
            } else {
                // 不支持的浏览器将直接刷新 不再显示动画
                location.reload();
            }
        })(window);
    </script>
</body>
</html>
